From 4490633ab509e2d01833dc3b7a007c650eafeeb3 Mon Sep 17 00:00:00 2001 From: pdns-recursor packagers Date: Tue, 19 May 2020 09:52:06 +0100 Subject: [PATCH] hostname-4.1.15 =================================================================== Gbp-Pq: Name hostname-4.1.15.diff --- rec-carbon.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rec-carbon.cc b/rec-carbon.cc index f8098ed..3ffde28 100644 --- a/rec-carbon.cc +++ b/rec-carbon.cc @@ -26,9 +26,11 @@ try return; if(hostname.empty()) { - char tmp[80]; + char tmp[HOST_NAME_MAX+1]; memset(tmp, 0, sizeof(tmp)); - gethostname(tmp, sizeof(tmp)); + if (gethostname(tmp, sizeof(tmp)) != 0) { + throw std::runtime_error("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: " + stringerror()); + } char *p = strchr(tmp, '.'); if(p) *p=0; -- 2.30.2